<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTagsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tags', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->string('name')->comment('标签名称');
            $table->unsignedInteger('hot')->unsigned()->comment('标签热度');
            $table->timestamps();
        });
        $driverName = Schema::getConnection()->getDriverName();
        if ('mysql' === $driverName) {
            DB::update(<<<END
                ALTER TABLE `comment`
                ENGINE=InnoDB,
                DEFAULT CHARACTER SET=utf8,
                AUTO_INCREMENT=100;
END
            );
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tags');
    }
}
